package tij4.concurrent.exercise.ex16;

import java.util.concurrent.locks.ReentrantLock;

public class LockTest1 {
    private ReentrantLock lock1 = new ReentrantLock();
    private ReentrantLock lock2 = new ReentrantLock();
    private ReentrantLock lock3 = new ReentrantLock();

    public void fun1() {
        lock1.lock();
        try {
            while (true) {
                System.out.println("fun1()");
            }
        }finally {
            lock1.unlock();
        }
    }

    public void fun2() {
        lock2.lock();
        try {
            while (true) {
                System.out.println("fun2()");
            }
        }finally {
            lock2.unlock();
        }
    }

    public void fun3() {
        lock3.lock();
        try {
            while (true) {
                System.out.println("fun3()");
            }
        }finally {
            lock3.unlock();
        }
    }
}
